home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Menus / Menus_8.AMOS / Menus_8.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  5.6 KB  |  190 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         MENUS 8         * 
  5. '*                         *                  MENUS AND BANKS
  6. '* (c) Europress Software  * 
  7. '*                         * 
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'GENERAL 
  13. '------------------------------------------- 
  14. 'An entire menu definition may be saved to a bank which will be saved along
  15. 'with your program, this will reduce the listing size of the program as the  
  16. 'coding for the menu set-up can be deleted as it is no longer required.
  17. '
  18. '------------------------------------------- 
  19. 'Menu To Bank
  20. '------------------------------------------- 
  21. 'save a menu definition to a bank
  22. '
  23. 'eg.         Menu To Bank 7     (save to bank number 7)
  24. '
  25. 'If the bank number stated already exists then an error will be reported.
  26. '
  27. '------------------------------------------- 
  28. 'Bank To Menu
  29. '------------------------------------------- 
  30. 'restore a menu definition from a bank 
  31. '
  32. 'eg.        Bank To Menu 6      (restore from bank number 6) 
  33. '
  34. 'The menu is restored in its original form and if the menu is large then 
  35. 'this may take a little time to set up.
  36. 'The menu will be activated when the Menu On instruction is used.
  37. '
  38. '------------------------------------------- 
  39. 'Menu Calc 
  40. '------------------------------------------- 
  41. 'recalculate a menu
  42. '
  43. 'If any new items are added to a menu (or old ones deleted or replaced) the  
  44. 'menu will be automatically sorted out the next time the right mouse button
  45. 'is pressed. 
  46. 'If the menu is large then this will take a little time, Menu Calc allows  
  47. 'this to be performed at the most appropriate point to avoid any delays. 
  48. 'To avoid any corruption of the menu while it is being updated it is best
  49. 'if the menu is switched off while the recalculation takes place.
  50. '
  51. 'eg      Menu Off      (freeze menu) 
  52. '        Menu Calc     (recalculate menu)
  53. '        Menu On       (re-activate menu)
  54. '
  55. '------------------------------------------- 
  56. 'WORKING EXAMPLE 
  57. '------------------------------------------- 
  58. '
  59. ' The following program defines a menu which is then saved to a bank, this 
  60. ' menu bank will be used in the final tutorial of this section showing an
  61. ' example of a full menu in operation. 
  62. '
  63. '------------------------------------------- 
  64. Rem *** tidy up the screen 
  65. '
  66. Screen Open 0,320,200,32,Lowres
  67. Load "AMOSPro_Tutorial:Objects/Menu_Bobs.Abk"
  68. '
  69. Palette 0,$AC
  70. Flash Off : Curs Off : Cls 0 : Pen 0 : Paper 1
  71. '
  72. Rem *** set the menu titles
  73. '
  74. Menu Static 1
  75. Menu$(1)="PICTURE  ","(IN1,2)(SS4)PICTURE(SS0)"
  76. Menu$(2)="SELECT  ","(IN1,2)(SS4)SELECT(SS0)"
  77. Menu$(3)="COLOURS  ","(IN1,2)(SS4)COLOURS(SS0)"
  78. Menu$(4)="MODE  ","(IN1,2)(SS4)MODE(SS0)"
  79. Menu$(5)="PATTERN ","(IN1,2)(SS4)PATTERN(SS0)"
  80. '
  81. Rem *** set the options  
  82. '
  83. Paper 1
  84. Menu$(1,1)=" >>>LOAD IFF ","(IN1,2) LOAD IFF>>> "
  85. Menu$(1,2)=" <<<SAVE IFF ","(in1,2) SAVE IFF<<< "
  86. Menu$(1,3)="    clear    ","(in1,2)    CLEAR    "
  87. Menu$(1,4)="    undo     ","(in1,2)    UNDO     "
  88. Menu$(1,5)="    quit     ","(in1,2)    QUIT     "
  89. '
  90. Paper 1
  91. Menu$(2,1)=" FOREGROUND COLOUR "
  92. Menu$(2,2)=" BACKGROUND COLOUR "
  93. Menu$(2,3)=" OUTLINE ON        "
  94. Menu$(2,4)=" OUTLINE OFF       "
  95. Menu$(2,5)=" OUTLINE COL       "
  96. Menu$(2,5,1)=" OUTLINE COL      "
  97. Paper 1
  98. For N=0 To 15
  99.    Pen N : Menu$(2,5,N+1)="     ","(IN1,0)>> <<"
  100. Next 
  101. '
  102. Menu Separate 2
  103. Paper 1
  104. For N=0 To 31
  105.    Pen N : Menu$(3,N+1)="     ","(IN1,0)>> <<"
  106. Next 
  107. Menu Link 2
  108. '
  109. Paper 1 : Pen 0
  110. Menu$(4,1)=" FREEHAND(LO 78,0)(BO2)","(LO 78,0)(BO10)"
  111. Menu$(4,2)=" LINE    (LO 78,0)(BO3)","(LO 78,0)(BO11)"
  112. Menu$(4,3)=" TEXT    (LO 78,0)(BO4)","(LO 78,0)(BO12)"
  113. Menu$(4,4)=" CIRCLE  (LO 78,0)(BO5)","(LO 78,0)(BO13)"
  114. Menu$(4,5)=" ELLIPSE (LO 78,0)(BO6)","(LO 78,0)(BO14)"
  115. Menu$(4,6)=" BOX     (LO 78,0)(BO7)","(LO 78,0)(BO15)"
  116. Menu$(4,7)=" BAR     (LO 78,0)(BO8)","(LO 78,0)(BO16)"
  117. Menu$(4,8)=" PAINT   (LO 78,0)(BO9)","(LO 78,0)(BO17)"
  118. '
  119. Paper 1 : Pen 0
  120. Menu$(5,1)="   PATTERN FILL ON    "
  121. Menu$(5,2)="   PATTERN FILL OFF   "
  122. Menu$(5,3)=" SELLECT FILL PATTERN "
  123. Pen 0 : Paper 1
  124. Menu$(5,3,1)="(PA1)(BA 30,15)"
  125. Menu$(5,3,2)="(PA2)(BA 30,15)"
  126. Menu$(5,3,3)="(PA3)(BA 30,15)"
  127. Menu$(5,3,4)="(PA4)(BA 30,15)"
  128. Menu$(5,3,5)="(PA5)(BA 30,15)"
  129. Menu$(5,3,6)="(PA6)(BA 30,15)"
  130. Menu$(5,3,7)="(PA7)(BA 30,15)"
  131. Menu$(5,3,8)="(PA8)(BA 30,15)"
  132. Menu$(5,3,9)="(PA9)(BA 30,15)"
  133. Menu$(5,3,10)="(PA10)(BA 30,15)"
  134. Menu$(5,3,11)="(PA11)(BA 30,15)"
  135. Menu$(5,3,12)="(PA12)(BA 30,15)"
  136. Menu$(5,3,13)="(PA13)(BA 30,15)"
  137. Menu$(5,3,14)="(PA14)(BA 30,15)"
  138. Menu$(5,3,15)="(PA15)(BA 30,15)"
  139. Menu$(5,3,16)="(PA16)(BA 30,15)"
  140. Menu$(5,3,17)="(PA17)(BA 30,15)"
  141. Menu$(5,3,18)="(PA18)(BA 30,15)"
  142. Menu$(5,3,19)="(PA19)(BA 30,15)"
  143. Menu$(5,3,20)="(PA20)(BA 30,15)"
  144. Menu$(5,3,21)="(PA21)(BA 30,15)"
  145. Menu$(5,3,22)="(PA22)(BA 30,15)"
  146. Menu$(5,3,23)="(PA23)(BA 30,15)"
  147. Menu$(5,3,24)="(PA24)(BA 30,15)"
  148. Menu$(5,3,25)="(PA25)(BA 30,15)"
  149. Menu$(5,3,26)="(PA26)(BA 30,15)"
  150. Menu$(5,3,27)="(PA27)(BA 30,15)"
  151. Menu$(5,3,28)="(PA28)(BA 30,15)"
  152. Menu$(5,3,29)="(PA29)(BA 30,15)"
  153. Menu$(5,3,30)="(PA30)(BA 30,15)"
  154. Menu$(5,3,31)="(PA31)(BA 30,15)"
  155. Menu$(5,3,32)="(PA32)(BA 30,15)"
  156. '
  157. Set Menu(5,3,1) To 20,14
  158. Set Menu(5,3,9) To 32,-112
  159. Set Menu(5,3,17) To 32,-112
  160. Set Menu(5,3,25) To 32,-112
  161. Set Menu(1,1) To 0,13
  162. Set Menu(2,1) To -14,13
  163. Set Menu(3,1) To -16,13
  164. Set Menu(3,17) To 18,-150
  165. Set Menu(4,1) To -38,13
  166. Set Menu(5,1) To -116,13
  167. Erase 6
  168. Menu To Bank 6
  169. '
  170. Rem *** start the automatic checking 
  171. '
  172. Menu On 
  173. On Menu Proc CONTROL
  174. On Menu On 
  175. Pen 3 : Paper 0 : Locate 0,13 : Centre "PRESS RIGHT MOUSE KEY TO SEE MENU"
  176. Pen 5 : Locate 0,17 : Centre "P.S.- the quit works!"
  177. '
  178. Rem *** loop whilst waiting for menu 
  179. '
  180. Do 
  181. Loop 
  182. '
  183. Procedure CONTROL
  184.    C=Choice(2)
  185.    If C=5
  186.       Edit 
  187.    End If 
  188.    On Menu On 
  189. End Proc
  190. '